package uk.ac.sanger.dasregistry.timer;

import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class MirroringWrapper implements Job{
	public void execute(JobExecutionContext arg0) throws JobExecutionException {
		BeanFactory ctx=(new ClassPathXmlApplicationContext("SpringDAO.xml"));
		Mirroring mirror=(Mirroring)ctx.getBean("mirror");
		mirror.mirrorAll(false);
		//do we want to run clean servers here as well to make sure numbers add up for servers that have owners
		//should already be running after someone has succesfully registered a new server? is it?
		CleanRegistry clean=(CleanRegistry)ctx.getBean("clean");
		clean.cleanServers();
	}
	
}
